package com.fwtai.config;

/**
 * 全局数据源
*/
public final class DataSourceContextHolder {

  private final static ThreadLocal<String> local = new ThreadLocal<>();

  public static ThreadLocal<String> getLocal() {
    return local;
  }

  public static void read() {
    local.set(DataSourceType.READ.getType());
  }

  public static void write() {
    local.set(DataSourceType.WRITE.getType());
  }

  public static String getJdbcType() {
    return local.get();
  }

  //清除数据源（名）
  public static void remove(){
    local.remove();
  }
}